<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<!-- <link rel="stylesheet" type="text/css" href="../css/reset.css"/> -->
		<link rel="stylesheet" type="text/css" href="../css/logins.css"/>
	</head>
	<body>
		<div id="top">
			<div id="top-header">
				<div class="top-logo">
				<a href="index.html"></a>
				</div>
				<div class="top-service">
				</div>
			</div>
		</div>
		<div id="cents">
		<div class="centent">
			<div class="centent-tou">
				<div class="centent-btn">
					<div class="centent-btn-a1">
						<div class="centent-btn-a1-b1">
							<div class="centent-btn-a1-b1-c1"><span>扫码登陆</span></div>
							<div class="centent-btn-a1-b1-c2"><span>账户登录</span></div>
						</div>
						<div class="centent-btn-a1-b2">
							<div class="centent-pr1">
								<div class="centent-pr1-s1">
									<div class="cent-er">
										<div id="imgas">
											<img src="../img/login-img/getQrImage.png" />
											<div class="imgas-xbt"></div>
										</div>
									</div>
									<div class="cent-er2">
										<span></span>
										<p>打开<span>唯品会APP-个人中心</span>，扫一扫登录</p>
									</div>
								</div>
							</div>
							<div class="centent-pr2">
								<div class="cent-er2-btn">
									
									<!-- 用户框 -->
									<div class="cent-er2-btn-s1">
										<div>
											<div class="pr2-logo1"></div>
											<div>
												<input type="text"  name="" id="male1" value="" placeholder="手机号/用户名/绑定邮箱"/>
											</div>
											<div class="pr2-logo2"></div>
											
										</div>
										<div>
											<span class="bian1"></span>
										</div>
									</div>
									<!-- 密码框 -->
									<div class="cent-er2-btn-s2">
										<div>
											<div class="pr2-logo1-a1"></div>
											<div>
												<input type="text"  name="" id="male2" value="" placeholder="密码"/>
											</div>
											<div class="pr2-logo2-a1"></div>
											
										</div>
										<div>
											<span class="bian2"></span>
										</div>
									</div>
									
									<div class="centent-yz">
										<div class="centent-yz-hz">
											<div><a href="#">短信验证登录</a></div>
											<div>忘记密码</div>
										</div>
										<div class="centent-bot">
											<button type="button">登录</button>
											
										</div>
									</div>
									
								</div>
							</div>
						</div>
					</div>
					<div class="centent-btn-a2">
						<div class="bom-ctn">
							<div class="bom-ctn-s1">
								<div>
									<hr />
								</div>
								<div></div>
								<div>
									<hr />
								</div>
							</div>
						</div>
						<div class="centent-bom-di">
							<div>
								<ul class="centent-bom-ul">
									<li>新浪微博</li>
									<li>QQ</li>
									<li>支付宝</li>
									<li class="btn3"><a href="javascript:;">更多↓</a></li>
									<li class="ba"><a href="../wangye/zhuce.html">免费注册</a></li>
								</ul>
							</div>
						</div>
					</div>
					<div class="cent-genduo">
						<div>
							<ul class="cent-ul">
								<li>网&nbsp;易</li>
								<li>人人网</li>
								<li>开心网</li>
								<li>翼支付</li>
							</ul>
						</div>
						<div>
							<span class="cent-logo"></span>
							<p>关于建行、中国移动登录失败通知，请查看</p>
						</div>
					</div>
				</div>
				
			</div>
		</div>
		</div>
		<footer></footer>
		<script src="../js/login.js"></script>
	</body>
</html>
<script src="../js/jQuery.js"></script>
<script>
	$("footer").load("../wangye/footer.html")
	$('#male1').blur(function(){
		$.get("../goodsAndShoppingCart/checkUser.php?username="+$('#male1').val(),function(resText){
			if(resText==0){
				$('.pr2-logo2').html("√").css({color:"green"})
			}else{
				$('.pr2-logo2').html("×")
			}
		})
	});
	$('button').click(function(){
		$.post('../goodsAndShoppingCart/login.php',{'username':$('#male1').val(),'userpass':$('#male2').val()},function(data){
			if(data.trim()=='success'){
				if(confirm('是否跳转至主页')){
					setCookie('username',$("#male1").val(),7)
					setCookie('userpass',$("#male2").val(),7)
					location.href='index.html'
				}
				}else {
				
				alert("账号密码有误，请重新输入")
			}
		})
	})
	function setCookie(key, value, day) {
							//   document.cookie = `key=value;expires=日期对象`
							var d = new Date();
							d.setDate(d.getDate() + day);

							document.cookie = `${key}=${value};expires=${d}`;
						}

						// 封装一个getCookie()   获取cookie的函数
						function getCookie(value) {
							var cookie = document.cookie;// username=zhangsan; sex=男; age=18
							var arr = cookie.split('; ');// ['username=zhangsan','sex=男','age=18']
							for (var i in arr) {//item  'username=zhangsan'    'sex=男'    'age=18'
								var newarr = arr[i].split('=');//第一项 ["username",'zhangsan']      第二项 ...  ['sex','男']
								if (newarr[0] == value) {
									return newarr[1]; //如果存在value， 说明 newarr[1]就想要的结果  return 终止函数的执行
								}
							}
							return '';
						}
</script>
